<template>
  <div class="box">
    <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
    <div ref="chart" style="height:600px;"></div>
  </div>
</template>

<script>
  export default {
    mounted() {
      this.getEchartData();
    },
    methods: {
      getEchartData() {
        let myChart = this.$echarts.init(this.$refs.chart);

        this.$ajax.get("/report/getMemberReport").then(res => {
          myChart.setOption({
            title: {
              text: '会员数量'
            },
            tooltip: {},
            legend: {
              data: ['会员数量']
            },
            xAxis: {
              data: res.data.monthList //动态数据
            },
            yAxis: {
              type: 'value'
            },
            series: [{
              name: '会员数量',
              type: 'line',
              data: res.data.memberCount
            }]
          });
        });
      }
    }
  }
</script>

<style>
</style>
